package com.camps.sdk.decrypt;

import com.camps.sdk.common.Constants;
import com.camps.sdk.entity.DeviceUpMessage;
import com.camps.sdk.entity.M1Card;

/**
 * @Author ldaoliang
 * @Date create in 15:58 2021/9/1
 * @Description
 */
public class AnalyzeM1CardChange implements AnalyticalData {
    @Override
    public DeviceUpMessage parseData(String originalData) {
        //*XX,YYYYYYYYYYYYYYY,SETM1,HHMMSS,M1,DDMMYY,tracker_status#
        //解密
        String[] split = parseCommand(originalData);
        String imei = split[1];
        String commandNumber = split[3];
        String mCard = split[4];//改变后的m1卡号
        String date = split[5];//日月年
        String deviceStatus = split[6];
        M1Card m1Card = new M1Card();
        m1Card.setDeviceStatus(deviceStatus);
        m1Card.setDeviceDate(date);
        m1Card.setM1Card(mCard);
        m1Card.setImei(imei);
        m1Card.setDeviceTime(commandNumber);
        m1Card.setCommandNumber(commandNumber);
        return structureMessage(Constants.REPLY,Constants.CMD_SET_M1_CARD,false,"",m1Card);
    }
}
